<template>
<!--登录页面-->
  <div id="login">
    <video src="../assets/video/wanglujia.mp4" class="video_gb" autoplay muted loop></video>
    <div class="bg_mask"></div>
    <h2>5426图书管理系统</h2>
    <el-form ref="form" class="login_box" size="normal">
      <el-form-item prop="username">
        <el-input prefix-icon="el-icon-user-solid" v-model="username" placeholder="请输入账号"></el-input>
      </el-form-item>
      <el-form-item prop="password">
        <el-input prefix-icon="el-icon-lock" v-model="password" show-password placeholder="请输入密码"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button style="width: 100%" type="primary" @click="login">登 录</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "Login",
  data() {
    return {
      adminList:[
       {
         username:"wlj",
         password:"123",
       },
       {
         username:"zyx",
         password:"123",
       }
     ],
      username:"",
      password:"",
    }
  },
  methods:{
    login(){
      let a=true;
      for (let i = 0; i < this.adminList.length; i++) {
        if (this.adminList[i].username===this.username && this.adminList[i].password===this.password){
          //登录成功!
          break;
        }else{//登录失败
          a=false;
        }
      }
      if (a){
        this.$message({
          message: '登录成功!',
          type: 'success'
        });
        this.$router.push("/usermanage");
      }else{
        this.$message.error('登录失败!');
      }

    }
  }
}
</script>

<style scoped>
#login{
  position: relative;
  margin: -8px;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
#login h2{
  text-align: center;
  font-size: 25px;
  color: #ffffff;
}
.login_box{
  position: absolute;
  width: 400px;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-70%);
}
.video_gb{
  position: absolute;
  top: 0;
  left: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: fill;
  filter: blur(2px);
}
.bg_mask{
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.5);
}
</style>
